home *** CD-ROM | disk | FTP | other *** search
/ Champak 62 / Volume 62 - JOGO DISK .iso / Games / penguin_dinner.swf / scripts / __Packages / classes / game / HeroCommandQueue.as < prev    next >
Text File  |  2008-03-17  |  711b  |  37 lines

  1. class classes.game.HeroCommandQueue
  2. {
  3.    var closed = false;
  4.    var QUEUED_COMMANDS_MAX = 4;
  5.    function HeroCommandQueue()
  6.    {
  7.       this.commands = [];
  8.    }
  9.    function enqueue(c)
  10.    {
  11.       if(this.commands.length > this.QUEUED_COMMANDS_MAX)
  12.       {
  13.          return undefined;
  14.       }
  15.       this.commands.unshift(c);
  16.    }
  17.    function dequeue()
  18.    {
  19.       if(this.commands.length == 0 || this.closed)
  20.       {
  21.          return null;
  22.       }
  23.       this.closed = true;
  24.       var _loc2_ = this.commands.pop();
  25.       return _loc2_;
  26.    }
  27.    function clear()
  28.    {
  29.       this.commands = [];
  30.       this.closed = false;
  31.    }
  32.    function open()
  33.    {
  34.       this.closed = false;
  35.    }
  36. }
  37.